#include "NorApplication.h"
#include "NorLibrary.h"
#include <QDebug>

#include "UI/ModRun/Output/FactoryOutput.h"

NorApplication::NorApplication()
{

}

NorApplication::~NorApplication()
{

}


//步骤2;
bool NorApplication::Step2()
{
    QString strOutput = "NorApplication::Step2";
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }
	return true;
}

//步骤4;
void NorApplication::Step4()
{
    QString strOutput = "NorApplication::Step4";
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }
}

//稳定流程;
void NorApplication::Run()
{
	NorLibrary libTemp;

    QString strOutputStart = "NorApplication::组装过程调用start";
    qDebug() << strOutputStart;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutputStart };
        pOutPut->OutPut(outList);
    }

	libTemp.Step1();

	if (Step2())
	{
		libTemp.Step3();
	}

	for (size_t i = 0; i < 4; i++)
	{
		Step4();
	}

	libTemp.Step5();

    QString strOutputEnd = "NorApplication::组装过程调用end";
    qDebug() << strOutputEnd;
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutputEnd };
        pOutPut->OutPut(outList);
    }
}
